package com.v0710.docommon.exception;


import com.v0710.docommon.dto.R;
import com.v0710.docommon.dto.RCode;
import lombok.Data;
import lombok.EqualsAndHashCode;


@Data
@EqualsAndHashCode(callSuper = true)
public class SysException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private String msg;
    private int code = 500;
    private R resultDTO;

    public SysException(RCode code) {
        super(code.getMessage());
        this.msg = code.getMessage();
        this.code = code.getCode();
    }

    public SysException(String msg) {
        this.msg = msg;
    }
    public SysException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
    }
    public SysException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;

    }
    public SysException(String msg, int code, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.code = code;
    }

    @Override
    public String toString() {
        return super.toString();
    }
}
